* mediaWiki.confirmCloseWindow now returns an object of functions, instead of
one function. The callback can't be called directly any more. The callback
function is replaced with confirmCloseWindow.release().
+* BREAKING CHANGE: Added an optional ResouceLoaderContext parameter to
+ ResourceLoaderModule::getDependencies(). Extension classes that override that
+ method should be updated. If they aren't updated, PHP Strict standards
+ warnings will appear when E_STRICT error reporting is enabled. Note: in the
+ near future, this parameter will probably become non-optional.
* Removed maintenance script deleteImageMemcached.php.
* MWFunction::newObj() was removed (deprecated in 1.25).
ObjectFactory::getObjectFromSpec() should be used instead.
/**
* Updates page_touched for this page; called from LinksUpdate.php
*
+ * @param integer $purgeTime TS_MW timestamp [optional]
* @return bool True if the update succeeded
*/
- public function invalidateCache() {
+ public function invalidateCache( $purgeTime = null ) {
if ( wfReadOnly() ) {
return false;
}
$method = __METHOD__;
$dbw = wfGetDB( DB_MASTER );
$conds = $this->pageCond();
- $dbw->onTransactionIdle( function () use ( $dbw, $conds, $method ) {
+ $dbw->onTransactionIdle( function () use ( $dbw, $conds, $method, $purgeTime ) {
+ $dbTimestamp = $dbw->timestamp( $purgeTime ?: time() );
+
$dbw->update(
'page',
- array( 'page_touched' => $dbw->timestamp() ),
- $conds,
+ array( 'page_touched' => $dbTimestamp ),
+ $conds + array( 'page_touched < ' . $dbw->addQuotes( $dbTimestamp ) ),
$method
);
} );
break;
case 'number':
- if ( ctype_digit( $value ) ) {
+ if ( ctype_digit( $value ) || is_int( $value ) ) {
$value = (int)$value;
} else {
$value = (float)$value;
$conditions['page_latest'] = $lastRevision;
}
- $now = wfTimestampNow();
$row = array( /* SET */
'page_latest' => $revision->getId(),
- 'page_touched' => $dbw->timestamp( $now ),
+ 'page_touched' => $dbw->timestamp( $revision->getTimestamp() ),
'page_is_new' => ( $lastRevision === 0 ) ? 1 : 0,
'page_is_redirect' => $rt !== null ? 1 : 0,
'page_len' => $len,
$revision = null;
// Update page_touched, this is usually implicit in the page update
// Other cache updates are done in onArticleEdit()
- $this->mTitle->invalidateCache();
+ $this->mTitle->invalidateCache( $now );
}
} else {
// Create new article
$editInfo = $this->mPreparedEdit;
}
- // Save it to the parser cache
+ // Save it to the parser cache.
+ // Make sure the cache time matches page_touched to avoid double parsing.
ParserCache::singleton()->save(
- $editInfo->output, $this, $editInfo->popts, $editInfo->timestamp, $editInfo->revid
+ $editInfo->output, $this, $editInfo->popts,
+ $revision->getTimestamp(), $editInfo->revid
);
// Update the links tables and other secondary data
// Update existence markers on article/talk tabs...
$other = $title->getOtherPage();
- $other->invalidateCache();
$other->purgeSquid();
$title->touchLinks();
// Update existence markers on article/talk tabs...
$other = $title->getOtherPage();
- $other->invalidateCache();
$other->purgeSquid();
$title->touchLinks();
/**
* setCacheTime() sets the timestamp expressing when the page has been rendered.
* This does not control expiry, see updateCacheExpiry() for that!
- * @param string $t
+ * @param string $t TS_MW timestamp
* @return string
*/
public function setCacheTime( $t ) {
/**
* Gets list of names of modules this module depends on.
- *
+ * @param ResourceLoaderContext context
* @return array List of module names
*/
- public function getDependencies() {
+ public function getDependencies( ResourceLoaderContext $context = null ) {
return $this->dependencies;
}
}
/**
+ * @param ResourceLoaderContext $context
* @return array
*/
- public function getDependencies() {
+ public function getDependencies( ResourceLoaderContext $context = null ) {
return array( 'mediawiki.language.init' );
}
}
);
}
- public function getDependencies() {
+ /**
+ * @param ResourceLoaderContext $context
+ * @return array
+ */
+ public function getDependencies( ResourceLoaderContext $context = null ) {
return array( 'mediawiki.language.init' );
}
*
* To add dependencies dynamically on the client side, use a custom
* loader script, see getLoaderScript()
+ *
+ * Note: It is expected that $context will be made non-optional in the near
+ * future.
+ *
+ * @param ResourceLoaderContext $context
* @return array List of module names as strings
*/
- public function getDependencies() {
+ public function getDependencies( ResourceLoaderContext $context = null ) {
// Stub, override expected
return array();
}
}
/**
+ * @param ResourceLoaderContext $context
* @return array
*/
- public function getDependencies() {
+ public function getDependencies( ResourceLoaderContext $context = null ) {
return array( 'mediawiki.language' );
}
$registryData[$name] = array(
'version' => $versionHash,
- 'dependencies' => $module->getDependencies(),
+ 'dependencies' => $module->getDependencies( $context ),
'group' => $module->getGroup(),
'source' => $module->getSource(),
'loader' => $module->getLoaderScript(),
protected $targets = array( 'desktop', 'mobile' );
/**
+ * @param ResourceLoaderContext $context
* @return array List of module names as strings
*/
- public function getDependencies() {
+ public function getDependencies( ResourceLoaderContext $context = null ) {
return array( 'user.defaults' );
}
return array( '' => $this->styles );
}
- public function getDependencies() {
+ public function getDependencies( ResourceLoaderContext $context = null ) {
return $this->dependencies;
}
'Action text is equal to expected text'
);
- $this->assertEquals(
+ $this->assertSame( // ensure types and array key order
$extra['api'],
self::removeApiMetaData( $formatter->formatParametersForApi() ),
'Api log params is equal to expected array'
array(
'text' => 'User merged OldPage into NewPage (revisions up to 16:07, 4 August 2014)',
'api' => array(
- 'mergepoint' => '2014-08-04T16:07:10Z',
'dest_ns' => 0,
'dest_title' => 'NewPage',
+ 'mergepoint' => '2014-08-04T16:07:10Z',
),
),
),
'legacy' => true,
'text' => 'User merged OldPage into NewPage (revisions up to 16:07, 4 August 2014)',
'api' => array(
- 'mergepoint' => '2014-08-04T16:07:10Z',
'dest_ns' => 0,
'dest_title' => 'NewPage',
+ 'mergepoint' => '2014-08-04T16:07:10Z',
),
),
),
'namespace' => NS_USER,
'title' => 'New user',
'params' => array(
- '4::userid' => '1',
+ '4::userid' => 1,
),
),
array(
'namespace' => NS_USER,
'title' => 'UTSysop',
'params' => array(
- '4::userid' => '1',
+ '4::userid' => 1,
),
),
array(
'namespace' => NS_USER,
'title' => 'UTSysop',
'params' => array(
- '4::userid' => '1',
+ '4::userid' => 1,
),
),
array(
'namespace' => NS_USER,
'title' => 'New user',
'params' => array(
- '4::userid' => '1',
+ '4::userid' => 1,
),
),
array(